PowerApps export as package fails due to missing connections
Table of contents:
Sometimes when we are working with PowerApps, adding new connections like to Microsoft Flow or external services and then we decide we don’t need some of them anymore and therefore we are removing it, but forgetting to first delete it in PowerApps, we are finding ourselves in situation, where when trying to export the app as a package, we are facing a very hard to debug issue.
When such situation can occur?
Imagine, you have a button that when clicked triggers Flow. Or is sending e-mail through Office365 Outlook connector. While working with the app you realizes, that the Flow is wrong, or the connector uses wrong credentials. So you are deleting the Flow or connector.
Next you realize, that the button in your PowerApp causes an error, because it is bond to a non-existing Flow/ Connector. So you simply remove that code from button’s “onclick” or replace it with something else, or… remove a button from the app instead of FIRST removing that related Flow/ Connection from the app, by clicking the Button, then “Action->Flows” and then from the associated list – “Remove from app”, like below:
Then you publish the app and… forget about that situation. Versions later you want to export it, but instead you only see a red bar (red!!!) showing: “Could not find flow ‘GUID’.” or “Could not find connection ‘GUID’.”:
Why export fails?
The reason why the issue appears is that export mechanism is trying to get all the Connections it has defined in app so therefore when importing the app later user is going to be able to define them and provide credentials. Since that particular connection doesn’t exist (as it was deleted), but there is still a reference to it from the application, export mechanism cannot find it, access it details and therefore to complete it’s execution.
How to debug?
There wouldn’t be nothing bad about the issue, if not the fact, that as a reason we are only given a GUID of the missing connection, not it’s name or any other information that could help us to debug.
Nevertheless even if we knew what was missing, I don’t know any way to restore that missing connection preserving it’s GUID.
Meanwhile, to find out what is missing, the simplest way is to do the following (I am using Visual Studio Code for that purpose):
- Save your app locally, on your computer,
- Change file extension from
*.msapp
to*.zip
, - DO NOT UNZIP! Just open using 7zip app for example,
- Open file:
{zip}\References\DataSources.json
, - Search for the displayed GUID,
- Press “F1” and type “Format Document” to get a nice looking JSON formatted file,
- Search the “Name” property inside the object that matches the GUID in the “
AddinConnectorId
” property.
So this is the name of the connection you are missing. Any bell rings in your head? I guess it should, as that is the only information you can find about it.
How to fix it?
If the button related to the issue is still inside your app and hopefully not replaced by anything else, or you know in which version the change was made and it is not tens of them before, you can simply click the button, then “Action->Flows” and then select to “Remove from app”:
Then publish new version and try again. Issue should be solved.
What if I cannot do it the easy way?
Additionally open “View” -> “Data sources” and find the not connected Flow there. Then simply remove it and again, save and publish app:
What if there is no missing connection in Data sources?
The only solution I found so far is to work on the files inside the saved locally *.msapp
file. There are basically two files that usually matches the displayed GUID:
- Properties.json – file located in a root of the msapp file,
- DataSources.json – file located in “References” subfolder.
To begin fixes first go through the below steps:
- Save your app locally, on your computer:
- Change file extension from
*.msapp
to*.zip
, - DO NOT UNZIP! Just open using 7zip app for example,
- Copy the two files mentioned above outside the ZIP file.
Now you’re ready to go fixing 🙂
DataSources.json
Steps then are as following (again, using Visual Studio Code):
- Open DataSources.json,
- Click “F1” and “Format Document” to get a readable JSON file,
- Search for the GUID,
- Once found, select all object that is containing it and remove it,
- Click “CTRL+A” to select all code of the file,
- Again click “F1” and type “Join Lines” to again put the code in a single line.
Finally move the file back to the ZIP file, to overwrite the existing file. Done!
Properties.json
That is the second file that should be fixed. It’s a bit more complex to make this one work. Steps here are as following (using Visual Studio Code):
- Open Properties.json,
- Click “F1” and “Format Document” to get a readable JSON file
- Search for the GUID,
- It should be found inside an escaped JSON code being a value of the “
LocalConnectionReferences
” attribute, - Copy it’s value, but without opening and closing quote,
- Paste copied text in new file,
- Change document type to JSON,
- Replace escaped quotes with quotes (
\\"
to"
) to get valid JSON,
- Press “F1” and “Format Document” to get a nice looking JSON structure,
- Remove the whole block containing missing GUID,
- “CTRL+A” to select all code,
- Again press “F1” and type “Join Lines” to get code back to single line,
- Again escape
"
replacing ” with\\"
, - Copy the code and replace the value of the “
LocalConnectionReferences
” attribute inside the “Properties.json” file.
Finally move the file back to the ZIP file, to overwrite the existing file. Done!
Uploading fixed file
Last step is to change back the extension of a file from *.zip
to *.msapp
. After doing that you’re ready to go.
Now is the time to open the new app in PowerApps designer. To do that go to the https://us.create.powerapps.com/studio/ url.
There click “Open” and “Browse” and navigate to the msapp file you would like to open:
After that simply wait until app is loaded. Once it is loaded, you will unfortunately need to re-configure all connection and fix issues. Finally save it as a new one (or overwrite the existing one) and then try to export it as package again. Works like a charm! 🙂
If you have any questions or comments please live them below!
Justin Baker
Hey Tomasz,
Great article. Very helpful. I can no longer edit files contained within the msapp file. I can pull them out and edit them then put them back inside the msapp file however Everytime I import the updated version the file I edited gets ignored and a new one generated. This happens even if I don’t change any content and just pull the file out of the msapp archive and put it back in.
For example, if I pull out the datasources.json then put the file back into the msapp archive with the same content and import the msapp, my data sources inside the power app are gone.
This used to work but no longer seems to. Does it still work for you?
Thx, Justin
Tomasz Poszytek
That really sounds impossible. So if you totally remove those files from the ZIP, will they be re-created? I doubt… Since PowerApps cannot know what is inside those files, right? So how could it generate those files again. To be honest I haven’t tried that for a longer while, but still it sounds rather impossible. Have you checked, that after you updated those files in ZIP file they actually got updated before you turned that ZIP back to msapp file?
Justin Baker
I think you misunderstand. I pull them out of the archive (msapp file) to my local machine then put them back into the archive and then I upload the msapp file. Yes, datasources.json get regenerated if I modified the datasources.json file contained in the msapp. And by modified pulling it out of the msapp file and putting it back in seems to be enough. Every powerapp would need a default datasources.json, so replacing a modified datasources.json with the default one is not a far stretch. The question is what is different. It’s not the content. I didn’t change the content, but there are metadata changes.
As best as I can tell – content wise nothing. However, the date has changed on the file and some metadata is being added by Windows 10 which persists when dragged into the zip file (msapp).
I did another test today w. properties.json. That I actually modified more than pull out of the archive and put back in. The change I made persisted. I tested again with a control file and when I uploaded the msapp back into powerapps the screen that I modified (the control files seems to be broken up by screen, there is one for app) is now removed from the app. It makes it look like it discarded the screen control file I modified.
I was trying to find out if you had seen the same behavior. Since the blog article was recent, I thought maybe you had done it recently.
It used to work for me, but that was some time ago and I was only trying again in the past week. The structure of the msapp has been updated since I had it work previously as well. If you haven’t tried it in a while and are interested, try saving the msapp to your local machine. Pull out the datasources.json from the msapp archive and put it on your local machine then put it right back into the msapp file overwriting the copy in there and upload. See if your datasources persist.
Blake
WOW this was awesome thank you so much for the detailed write up. For an application wanting to not be code based seems like there needs to be more user friendly extensions added into the PowerApps module to make things like this Native. After 8 hours of troubleshooting and trying to fix this issue I ran into your article. In less than an hour I was fully functioning again.
Tomasz Poszytek
I’m more than delighted that it helped you. Thanks for sharing 😃
Dileep
This is awesome. You saved my day. Thank you so much
Tomasz Poszytek
You are very much welcomed! 🙂
Alice
Hello Tomasz,
I am trying to export my app, but I get this error message.
Could you help me?
The specified flow “bb007d8c-1c18-43c3-92ab-544afa16d781” was deleted.
regards
Tomasz Poszytek
Hi, this is what this post is about 🙂 You need to remove that flow from connections inside your app. Go to “Flows” inside your Power App and delete the one that was deleted in Power Automate.
Alice
Thank you very much! It works. 🙂
Jojie
HI Tomasz, I am facing the same issue and this article seems helpful, however, after i’ve done all of it when I tried to upload the msapp file, I get an error file is corrupted.
Can you specify what do you mean of “remove the whole block containing missing GUID,”?
Thanks.
Tomasz Poszytek
Hi, I meant the key and value. So the reference to the missing datasource.
Marcin Jarząbek
Hi Tomasz,
I have a problem with exporting the app but the error I am getting is reffering to SQL connection (shared-sql-1f73aeb2-246a-4f38-9958-a1a6-f79b6462). I created a ZIP file from msapp and looked for this reference somewhere in the code but no results were found. Could you help me understand where is the problem?
Tomasz Poszytek
That is weird… There must be that connection present in config files of your exported app. Maybe it’s in the solution? And the app is not using connections directly, but just connection references?
Barry Gillard
Hi, I have followed your instruction and located the code GUID that is causing the issue within the Properties.Json
I am now stuck on what to do. The GUID causing the issue in 4d1ea161-9aa3-4670-8544-1f7ce5948c9c which can be found twice below. Please help
:\”https://connectoricons-prod.azureedge.net/releases/v1.0.1534/1.0.1534.2605/logicflows/icon.png\”,\”parameterHints\”:{\”workflowName\”:{\”value\”:\”4d1ea161-9aa3-4670-8544-1f7ce5948c9c\”},\”workflowEntityId\”:{\”value\”:\”081745a4-bd22-ec11-b6e6-6045bd87ef7b\”},\”312d8a07-73d3-43c3-94b9-1cab8165fb4d\”:{\”value\”:\”shared_sharepointonline_1\”},\”d7b8549f-4655-4948-838c-dfc2b14a6c6c\”:{\”value\”:\”shared_onedriveforbusiness_1\”}},\”parameterHintsV2\”:{\”workflowName\”:{\”value\”:\”4d1ea161-9aa3-4670-8544-1f7ce5948c9c\”},\”workflowEntityId\”:{\”value\”:\”081745a4-bd22-ec11-b6e6-6045bd87ef7b\”},\”shared_sharepointonline_1\”:{\”value\”:\”312d8a07-73d3-43c3-94b9-1cab8165fb4d\”},\”shared_onedriveforbusiness_1\”:
Tomasz Poszytek
You can follow the steps from this chapter: https://poszytek.eu/en/microsoft-en/office-365-en/powerapps-en/powerapps-export-fails-due-to-missing-components/#What_if_I_cannot_do_it_the_easy_way – in the end, try removing the whole block that contains the guid.
Himanshu Punjabi
Hi, Tomasz
This article was really helpful and gave us the direction to solve this issue with our application. However, instead of modifying the file to remove the reference, we just found the Dependent object for this GUID (Flow in our case), replaced it with a similar one created from the beginning, removed the old Dependent Object (Flow in our case) and then were able to publish the app.
However, thank you for the help.
Regards,
Himanshu Punjabi
Tomasz Poszytek
You’re welcome! And thanks for sharing your approach 🙂